package com.manager.user.module.dao;

import com.manager.commons.mybatis.annotation.MyBatisDao;
import com.manager.commons.mybatis.dao.GenericDao;
import com.manager.user.module.entity.FolderInfo;
import com.manager.user.module.entity.GenFiles;
import com.manager.user.module.entity.view.FileInfoView;
import com.manager.user.module.entity.view.FileUserPath;
import com.manager.user.module.entity.view.TreeNode;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * GenFilesDao
 * 文件管理
 *
 * @author manager
 * @version 1.0
 */
@MyBatisDao
public interface GenFilesDao extends GenericDao<GenFiles> {
    //批量插入
    int inserts(List<GenFiles> genFiles);

    List<FolderInfo> queryFolder(Map<String, Object> map);

    int countSearch(Map<String, Object> map);

    List<FileInfoView> queryFileSearch(Map<String, Object> map);

    List<FileInfoView> queryFileMap(Map<String, Object> map);

    //根据当前登录id查询所授权的目录
    List<FileUserPath> queryFileUser(Map<String, Object> map);

    //查询目录信息
    List<FolderInfo> queryHostFiles(Map<String, Object> map);

    //查询父级目录信息
    GenFiles findModelPath(Map<String, Object> map);

    //查询名字是否存在
    Integer findModelName(Map<String, Object> params);

    //根据ids查询所有文件信息
    List<GenFiles> querFileInfos(Map<String, Object> map);

    Integer updateFileName(@Param("oldPath") String oldPath, @Param("newPath") String newPath);

    Integer deleteFiles(@Param("id") String id);

    List<GenFiles> queryIdsPath(Map<String, Object> params);

    List<String> queryLevelId(Map<String, Object> params);


    List<TreeNode> findAllNodes(Map<String, Object> params);

    GenFiles findPid(@Param("_id") String id);


    List<FileInfoView> queryFileMapGid(Map<String, Object> map);

    int countMapGid(Map<String, Object> map);

    List<FileInfoView> queryFileMapGids(Map<String, Object> map);

    int countMapGids(Map<String, Object> map);
}
